const moduleObj = {
  task: [
    {
      title: '舰艇拖带',
      key: 'ship-towing-task'
    },
    {
      title: '海上补给运输',
      key: 'sea-supply-task'
    },
    {
      title: '海上生活交通',
      key: 'marine-life-task'
    },
    {
      title: '军事道路修建保养',
      key: 'military-road-task'
    },
    {
      title: '设备仓储服务',
      key: 'warehousing-service-task'
    },
    {
      title: '通用物资采购',
      key: 'material-procurement-task'
    },
    {
      title: '社区安保服务',
      key: 'security-services-task'
    },
    {
      title: '货物补给运输',
      key: 'maritime-1-task'
    },
    {
      title: '官兵日常外出交通',
      key: 'maritime-2-task'
    },
    {
      key: 'navigation-2-task',
      title: '助航应急保障服务'
    },
    {
      key: 'land-4-task',
      title: '机动应急保障运力'
    },
    {
      key: 'transport-1-task',
      title: '通用物资采购供应'
    },
    {
      key: 'transport-2-task',
      title: '副食品筹措、补给'
    },
    {
      key: 'procurement-1-task',
      title: '装备维修保障服务'
    },
    {
      key: 'procurement-4-task',
      title: '特种设备(舰船、装备)维护服务'
    },
    {
      key: 'remote-1-task',
      title: '远程装备维修'
    },
    {
      key: 'remote-2-task',
      title: '远程医疗'
    },
    {
      key: 'life-2-task',
      title: '交通保障'
    }
  ],
  engine: [
    {
      title: '航道疏浚',
      key: 'port-2-engine'
    },
    {
      key: 'land-1-engine',
      title: '公路道路修建保养'
    },
    {
      key: 'land-2-engine',
      title: '专用道路、特种运输基建及伪装'
    },
    {
      key: 'land-3-engine',
      title: '铁路专线修建、日常维护'
    },
    {
      key: 'procurement-5-engine',
      title: '舰船修造服务'
    },
  ],
  operate: [
    {
      title: '岸基设施维护',
      key: 'port-3-operate'
    },
    {
      key: 'navigation-1-operate',
      title: '助航设施建设维护'
    },
    {
      key: 'common-1-operate',
      title: '物业管理'
    },
    {
      key: 'common-2-operate',
      title: '设施设备维护保养'
    },
    {
      key: 'common-3-operate',
      title: '市政保障'
    },
    {
      key: 'common-4-operate',
      title: '基础设施设备升级、维修改造'
    },
    {
      key: 'security-1-operate',
      title: '安保服务'
    },
    {
      key: 'security-2-operate',
      title: '安全管控'
    },
    {
      key: 'security-3-operate',
      title: '海陆空巡查管控'
    }
  ],
  resources: [
    {
      key: 'procurement-2-resources',
      title: '共享仓储物流服务'
    },
    {
      key: 'life-1-resources',
      title: '便民生活保障'
    },
    {
      key: 'life-3-resources',
      title: '医疗保障'
    },
    {
      key: 'security-4-resources',
      title: '社情通告'
    },
    {
      key: 'remote-3-resources',
      title: '海情信息服务'
    }
  ]
};

const menuList = [
  {
    icon: 'icon-anjiguanli',
    key: 'port',
    title: '港务保障',
    children: [
      {
        title: '舰艇拖带',
        key: 'port-1-task'
      },
      {
        title: '航道疏浚',
        key: 'port-2-engine'
      },
      {
        title: '岸基设施维护',
        key: 'port-3-operate'
      }
    ]
  },
  {
    icon: 'icon-haiyun',
    key: 'maritime',
    title: '海上运输保障',
    children: [
      {
        title: '货物补给运输',
        key: 'maritime-1-task'
      },
      {
        title: '官兵日常外出交通',
        key: 'maritime-2-task'
      }
    ]
  },
  {
    icon: 'icon-fubiao',
    key: 'navigation',
    title: '海上助航设施维保',
    children: [
      {
        key: 'navigation-1-operate',
        title: '助航设施建设维护'
      },
      {
        key: 'navigation-2-task',
        title: '助航应急保障服务'
      }
    ]
  },
  {
    icon: 'icon-gonglu-',
    key: 'land',
    title: '陆上交通设施维保',
    children: [
      {
        key: 'land-1-engine',
        title: '公路道路修建保养'
      },
      {
        key: 'land-2-engine',
        title: '专用道路、特种运输基建及伪装'
      },
      {
        key: 'land-3-engine',
        title: '铁路专线修建、日常维护'
      },
      {
        key: 'land-4-task',
        title: '机动应急保障运力'
      }
    ]
  },
  {
    icon: 'icon-yingyongchengxu-wuzi-caigouguanli',
    key: 'transport',
    title: '通用物资采购',
    children: [
      {
        key: 'transport-1-task',
        title: '通用物资采购供应'
      },
      {
        key: 'transport-2-task',
        title: '副食品筹措、补给'
      }
    ]
  },
  {
    icon: 'icon-cangchu1',
    key: 'procurement',
    title: '专用装备维保',
    children: [
      {
        key: 'procurement-1-task',
        title: '装备维修保障服务'
      },
      {
        key: 'procurement-2-resources',
        title: '共享仓储物流服务'
      },
      {
        key: 'procurement-3-null',
        title: '试验适航保障服务'
      },
      {
        key: 'procurement-4-task',
        title: '特种设备(舰船、装备)维护服务'
      },
      {
        key: 'procurement-5-engine',
        title: '舰船修造服务'
      },
      {
        key: 'procurement-6-personnel',
        title: '军地人才培养服务'
      }
    ]
  },
  {
    icon: 'icon-yuancheng',
    key: 'remote',
    title: '远程智慧保障',
    children: [
      {
        key: 'remote-1-task',
        title: '远程装备维修'
      },
      {
        key: 'remote-2-task',
        title: '远程医疗'
      },
      {
        key: 'remote-3-ocean',
        title: '海情信息服务'
      }
    ]
  },
  {
    icon: 'icon-shenghuofuwu',
    key: 'life',
    title: '生活服务保障',
    children: [
      {
        key: 'life-1-resources',
        title: '便民生活保障'
      },
      {
        key: 'life-2-task',
        title: '交通保障'
      },
      {
        key: 'life-3-hospital',
        title: '医疗保障'
      }
    ]
  },
  {
    icon: 'icon-IOTtubiao_huabanfuben',
    key: 'common',
    title: '通用基础设施维保',
    children: [
      {
        key: 'common-1-operate',
        title: '物业管理'
      },
      {
        key: 'common-2-operate',
        title: '设施设备维护保养'
      },
      {
        key: 'common-3-operate',
        title: '市政保障'
      },
      {
        key: 'common-4-operate',
        title: '基础设施设备升级、维修改造'
      }
    ]
  },
  {
    icon: 'icon-guankong',
    key: 'security',
    title: '联防联控安保',
    children: [
      {
        key: 'security-1-operate',
        title: '安保服务'
      },
      {
        key: 'security-2-operate',
        title: '安全管控'
      },
      {
        key: 'security-3-operate',
        title: '海陆空巡查管控'
      },
      {
        key: 'security-4-resources',
        title: '社情通告'
      }
    ]
  }
];

// 任务状态池

const taskStateObj = {
  assigned: '派发中',
  doing: '执行中',
  finish: '已完结',
  abnormal: '异常',
};

const priorityObj = {
  '1': '低',
  '2': '一般',
  '3': '紧急',
  '4': '非常紧急'
};

// 任务数据
const taskInfoList = [
  {
    type: '舰艇拖带',
    id: 'port-1',
    code: 'FH02841',
    planEndTime: '2021-06-15',
    state: 'assigned',
    priority: '1',
    taskType: 'in',
    taskDesc: '',
    portName: '',
    trayCode: '',
    vesselNum: '',
    contact: '李涛',
    contactPhone: '15374684329',
    assignee: '刘天龙',
    assigneePhone: '17637472811',
    currentStep: -1
  },
  {
    type: '舰艇拖带',
    id: 'port-1',
    code: 'FH02842',
    planEndTime: '2021-02-08',
    state: 'assigned',
    priority: '1',
    taskType: 'in',
    taskDesc: '',
    portName: '',
    trayCode: '',
    vesselNum: '',
    contact: '张海',
    contactPhone: '182374684329',
    assignee: '常远',
    assigneePhone: '13637472811',
    currentStep: -1
  },
  {
    type: '舰艇拖带',
    code: 'FH02843',
    id: 'port-1',
    planEndTime: '2021-04-30',
    state: 'doing',
    priority: '1',
    taskType: 'in',
    taskDesc: '',
    portName: '',
    trayCode: '',
    vesselNum: '',
    contact: '李天',
    contactPhone: '15274684329',
    assignee: '韩军',
    assigneePhone: '13437472811',
    currentStep: 2
  },
  {
    type: '舰艇拖带',
    code: 'FH02844',
    id: 'port-1',
    planEndTime: '2021-02-25',
    state: 'doing',
    priority: '1',
    taskType: 'in',
    taskDesc: '',
    portName: '',
    trayCode: '',
    vesselNum: '',
    contact: '高原',
    contactPhone: '13374684329',
    assignee: '张媛',
    assigneePhone: '17937472811',
    currentStep: 3
  },
  {
    type: '舰艇拖带',
    code: 'FH02845',
    id: 'port-1',
    planEndTime: '2021-02-13',
    state: 'finish',
    priority: '1',
    taskType: 'in',
    taskDesc: '',
    portName: '',
    trayCode: '',
    vesselNum: '',
    contact: '杨天元',
    contactPhone: '18374684329',
    assignee: '李贤',
    assigneePhone: '17637472811',
    currentStep: 4
  },
  {
    type: '舰艇拖带',
    code: 'FH02846',
    id: 'port-1',
    planEndTime: '2021-04-10',
    state: 'finish',
    priority: '1',
    taskType: 'in',
    taskDesc: '',
    portName: '',
    trayCode: '',
    vesselNum: '',
    contact: '王涛',
    contactPhone: '18374684329',
    assignee: '刘源',
    assigneePhone: '17637472811',
    currentStep: 4
  },
  {
    type: '舰艇拖带',
    code: 'FH02847',
    id: 'port-1',
    planEndTime: '2021-07-09',
    state: 'abnormal',
    priority: '1',
    taskType: 'in',
    taskDesc: '',
    portName: '',
    trayCode: '',
    vesselNum: '',
    contact: '侯鑫',
    contactPhone: '18374684329',
    assignee: '陈天源',
    assigneePhone: '17637472811',
    currentStep: 3
  },
  {
    type: '舰艇拖带',
    code: 'FH02848',
    id: 'port-1',
    planEndTime: '2021-06-10',
    state: 'abnormal',
    priority: '1',
    taskType: 'in',
    taskDesc: '',
    portName: '',
    trayCode: '',
    vesselNum: '',
    contact: '张浩',
    contactPhone: '15474684329',
    assignee: '李媛',
    assigneePhone: '15137472811',
    currentStep: 3
  }
];

const engineList = [
  {
    projectName: '董家口港口航道疏浚项目一期',
    projectAddress: '青岛市黄岛区烟沪线与港润大道交叉路口东南侧',
    id: 'port-2',
    projectClass: '维修性疏浚',
    projectStatus: '招标完成',
    projectStartTime: '2021-01-10',
    projectEndTime: '2022-03-22',
    projectCode: 'CH0000001',
    tip1: '',
    tip2: '',
    tip3: '',
    projectDesc: '',
    engineDate1: null,
    engineDate2: null,
    engineDate3: null,
    engineDate4: null,
    engineDate5: null,
    engineDate6: null,
    engineDate7: null,
    engineDate8: null,
    engineDate9: null,
    engineDate10: null,
    engineDate11: null,
    engineDate12: null,
    engineDate13: null,
    engineDate14: null,
    engineDate15: null,
    engineDate16: null,
    engineDate17: null,
    engineDate18: null,
    engineDate19: null,
    engineDate20: null,
    engineDate21: null,
    engineDate22: null,
    engineDate23: null,
    engineDate24: null,
    engineDate25: null,
    engineDate26: null,
    engineDate27: null,
    engineDate28: null,
    engineDate29: null,
    engineDate30: null,
    engineDate31: null,
    engineDate32: null,
    engineDate33: null,
    engineDate34: null,
    engineDate35: null,
    engineDate36: null,
    progress1: '',
    progress2: '',
    progress3: '',
    progress4: '',
    progress5: '',
    progress6: '',
    progress7: '',
    progress8: '',
    progress9: '',
    currFlowIndex: 0,
  },
  {
    projectName: '董家口港口临时性疏浚',
    projectAddress: '青岛市黄岛区烟沪线与港润大道交叉路口东南侧',
    id: 'port-2',
    projectClass: '临时性疏浚',
    projectStatus: '已完成',
    projectStartTime: '2021-09-10',
    projectEndTime: '2022-08-22',
    projectCode: 'CH0000002',
    tip1: '',
    tip2: '',
    tip3: '',
    projectDesc: '',
    engineDate1: null,
    engineDate2: null,
    engineDate3: null,
    engineDate4: null,
    engineDate5: null,
    engineDate6: null,
    engineDate7: null,
    engineDate8: null,
    engineDate9: null,
    engineDate10: null,
    engineDate11: null,
    engineDate12: null,
    engineDate13: null,
    engineDate14: null,
    engineDate15: null,
    engineDate16: null,
    engineDate17: null,
    engineDate18: null,
    engineDate19: null,
    engineDate20: null,
    engineDate21: null,
    engineDate22: null,
    engineDate23: null,
    engineDate24: null,
    engineDate25: null,
    engineDate26: null,
    engineDate27: null,
    engineDate28: null,
    engineDate29: null,
    engineDate30: null,
    engineDate31: null,
    engineDate32: null,
    engineDate33: null,
    engineDate34: null,
    engineDate35: null,
    engineDate36: null,
    progress1: '',
    progress2: '',
    progress3: '',
    progress4: '',
    progress5: '',
    progress6: '',
    progress7: '',
    progress8: '',
    progress9: '',
    currFlowIndex: 9,
  }
];

const equipTableList = [
  {
    id: 1,
    equipName: '半门式起重机',
    equipCode: 'sp0000001',
    personLiable: '张毅',
    equipType: '起重机',
    state: '正常',
    date: '2020-10-30'
  },
  {
    id: 2,
    equipName: '龙门吊',
    equipCode: 'sp0000002',
    personLiable: '王思琪',
    equipType: '起重机',
    state: '待验收',
    date: '2020-10-30'
  },
  {
    id: 3,
    equipName: '抓斗式',
    equipCode: 'sp0000003',
    personLiable: '赵安康',
    equipType: '起重机',
    state: '采购中',
    date: '2020-10-30'
  },
  {
    id: 8,
    equipName: '输送带',
    equipCode: 'sp0000004',
    personLiable: '冯源',
    equipType: '输送带',
    state: '完好',
    date: '2020-10-30'
  },
  {
    id: 4,
    equipName: '传送管',
    equipCode: 'sp0000005',
    personLiable: '李月斌',
    equipType: '传送管',
    state: '正常',
    date: '2020-10-30'
  },
  {
    id: 5,
    equipName: '船用卷扬机',
    equipCode: 'sp0000006',
    personLiable: '侯亮平',
    equipType: '卷扬机',
    state: '正常',
    date: '2020-10-30'
  },
  {
    id: 6,
    equipName: '疏浚船',
    equipCode: 'sp0000008',
    personLiable: '王翔',
    equipType: '疏浚船',
    state: '正常',
    date: '2020-10-30'
  },
  {
    id: 7,
    equipName: '快艇',
    equipCode: 'sp0000009',
    personLiable: '霍勇',
    equipType: '快艇',
    state: '已报废',
    date: '2020-10-30'
  },
  {
    id: 9,
    equipName: '引航船',
    equipCode: 'sp0000010',
    personLiable: '刘烨',
    equipType: '引航船',
    state: '正常',
    date: '2020-10-30'
  }
];
// 得到title
function getTitle(key) {
  let arr = menuList.filter(item => item.key === key);
  if (arr.length) {
    return arr[0].title;
  }
  return '';
}
function getSubTitle(key) {
  let arr = moduleObj[key.split('-')[2]];
  if (arr.length) {
    let list = arr.filter(item => item.key === key);
    if (list.length) {
      return list[0].title;
    }
    return '';
  }
  return '';
}
// 新增任务
function addTaskData(obj) {
  taskInfoList.unshift(obj);
}
// 获取任务
function getTaskInfo(code) {
  let arr = taskInfoList.filter(item => item.code === code);
  if (arr.length) {
    return {
      returnCode: 200,
      returnData: arr[0]
    }
  }
  return {
    returnCode: 400
  }
}
// 编辑任务
function editTaskInfo(obj) {
  taskInfoList.forEach((item, i) => {
    if (item.code === obj.code) {
      taskInfoList.splice(i, 1, obj);
    }
  });
}
// 获取工程数据
function getEngineList(id) {
  return engineList.filter(item => item.id === id);
}
// 新增工程
function addEngineInfo(obj) {
  engineList.unshift(obj);
}
// 获取工程
function getEngineInfo(code) {
  let arr = engineList.filter(item => item.code === code);
  if (arr.length) {
    return {
      returnCode: 200,
      returnData: arr[0]
    }
  }
  return {
    returnCode: 400
  }
}
// 编辑工程
function editEngineInfo(obj) {
  engineList.forEach((item, i) => {
    if (item.code === obj.code) {
      engineList.splice(i, 1, obj);
    }
  });
}
// 根据id获取设备数据
function getEquipById(id) {
  let arr = equipTableList.filter(item => item.id == id);
  if (arr.length) {
    return {
      returnCode: 200,
      returnData: arr[0]
    }
  }
  return {
    returnCode: 400
  }
}
// 新增设备台账数据
function insertEquipList(obj) {
  equipTableList.unshift(obj);
}

export default {
  moduleObj,
  menuList,
  taskInfoList,
  taskStateObj,
  priorityObj,
  engineList,
  equipTableList,
  getTitle,
  getSubTitle,
  addTaskData,
  getTaskInfo,
  editTaskInfo,
  getEngineList,
  addEngineInfo,
  getEngineInfo,
  editEngineInfo,
  getEquipById,
  insertEquipList
}
